package com.example.demo.mq.producer;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitProducer {
    @Autowired
    private AmqpTemplate amqpTemplate;

    public void sendDemoQueue(String msg){
        this.amqpTemplate.convertAndSend("demoQueue","队列：demoQueue，发送的消息: " + msg);
        System.out.println("发送消息成功");

    }
}
